package work04graphics;

public class Triangular {
    int a;
    int b;
    int c;
    double getTriangleArea() {
        double p;
        if(check() && a!=0 && b!=0 && c!=0) {
            p = (double) (a + b + c) /2;
            System.out.println("Triangle area is "+Math.sqrt(p*(p-a)*(p-b)*(p-c)));
            return  Math.sqrt(p*(p-a)*(p-b)*(p-c));
        }
        return 0;
    }

    public int getA() {
        return a;
    }

    public void setA(int a) {
        this.a = a;
    }

    public int getB() {
        return b;
    }

    public void setB(int b) {
        this.b = b;
    }

    public int getC() {
        return c;
    }

    public void setC(int c) {
        this.c = c;
    }
    public boolean check(){
        if(a+b<=c || a+c<=b || b+c<=a){
            System.out.println("不是三角形");
            return false;
        }
        return true;
    }
}
